package com.atguigu.edu.function;

import com.atguigu.edu.util.AtguiguUtil;
import org.apache.flink.table.annotation.DataTypeHint;
import org.apache.flink.table.annotation.FunctionHint;
import org.apache.flink.table.functions.TableFunction;
import org.apache.flink.types.Row;

import java.util.Set;

@FunctionHint(output = @DataTypeHint("row<kw string>"))
public class KwSplit extends TableFunction<Row> {
    public void eval(String item){
        Set<String> kws = AtguiguUtil.ikSplit(item);
        for (String kw : kws) {
            collect(Row.of(kw));
        }
    }
}